/*
** look_player_cardi.c for  in /home/renard/Dropbox/epitech/dev/projets/systemunix/zappy/zappy-2015-2014s-renard_g/serv-src
**
** Made by guillaume renard
** Login   <renard_g@epitech.net>
**
** Started on  Wed Jun 20 15:04:22 2012 guillaume renard
** Last update Thu Jul 19 17:51:24 2012 pierrick druart
*/

#include	"string.h"
#include	"server.h"
#include	"move_map.h"

void		look_player_n(t_game *game, t_gamer *gamer, t_mov m,
    t_string *string)
{
  int		lvl;
  t_inventory	cas;
  int		i;

  lvl = 1;
  cas = move_map_n(game->obj, &m, 0, 0);
  create_string(string, cas, m);
  string->concat(string, ",");
  while (lvl <= (int)gamer->level)
  {
    i = -(lvl);
    while (i <= lvl)
    {
      cas = move_map_n(game->obj, &m, lvl, i);
      create_string(string, cas, m);
      i++;
      if (i <= lvl)
	string->concat(string, ",");
    }
    lvl++;
    if (lvl <= (int)gamer->level)
      string->concat(string, ",");
  }
}

void		look_player_s(t_game *game, t_gamer *gamer, t_mov m,
    t_string *string)
{
  int		lvl;
  t_inventory	cas;
  int		i;

  lvl = 1;
  cas = move_map_n(game->obj, &m, 0, 0);
  create_string(string, cas, m);
  string->concat(string, ",");
  while (lvl <= (int)gamer->level)
  {
    i = -(lvl);
    while (i <= lvl)
    {
      cas = move_map_n(game->obj, &m, -(lvl), -(i));
      create_string(string, cas, m);
      i++;
      if (i <= lvl)
	string->concat(string, ",");
    }
    lvl++;
    if (lvl <= (int)gamer->level)
      string->concat(string, ",");
  }
}

void		look_player_e(t_game *game, t_gamer *gamer, t_mov m,
    t_string *string)
{
  int		lvl;
  t_inventory	cas;
  int		i;

  lvl = 1;
  cas = move_map_n(game->obj, &m, 0, 0);
  create_string(string, cas, m);
  string->concat(string, ",");
  while (lvl <= (int)gamer->level)
  {
    i = -(lvl);
    while (i <= lvl)
    {
      cas = move_map_n(game->obj, &m, -i, lvl);
      create_string(string, cas, m);
      i++;
      if (i <= lvl)
	string->concat(string, ",");
    }
    lvl++;
    if (lvl <= (int)gamer->level)
      string->concat(string, ",");
  }
}

void		void_funct(t_game *game, t_gamer *gamer, t_mov m,
    t_string *string)
{
  (void)game;
  (void)game;
  (void)gamer;
  (void)m;
  (void)string;
}

void		look_player_o(t_game *game, t_gamer *gamer, t_mov m,
    t_string *string)
{
  int		lvl;
  t_inventory	cas;
  int		i;

  lvl = 1;
  cas = move_map_n(game->obj, &m, 0, 0);
  create_string(string, cas, m);
  string->concat(string, ",");
  while (lvl <= (int)gamer->level)
  {
    i = -(lvl);
    while (i <= lvl)
    {
      cas = move_map_n(game->obj, &m, (i), -(lvl));
      create_string(string, cas, m);
      i++;
      if (i <= lvl)
	string->concat(string, ",");
    }
    lvl++;
    if (lvl <= (int)gamer->level)
      string->concat(string, ",");
  }
}
